Unofficial draft mode
code:mod.js
scrapbox.PageMenu.addItem({
title: 'Unofficial draft mode',
onClick: () => {
const className = 'unofficial-draft'
const page = document.querySelector('.page')
// Insert style tag if needed
let style = document.querySelector('style.style-unofficial-draft')
if (!style) {
style = document.createElement('style')
style.className = 'style-unofficial-draf'
style.innerText = .${className} { background-image: url("https://i.gyazo.com/c1f6178c8fc99524fccd6b25b8522526.png"); }
document.head.appendChild(style)
}
page.classList.contains(className) ?
page.classList.remove(className) : page.classList.add(className)
// Recalculate vertical and horizontal sizes of related cards
requestAnimationFrame(() => {dispatchEvent(new Event('resize'))})
}
})